package org.corey.wyp.utils
{
	public class Calculator
	{
		public static function getDaysInMonth(year:int,month:int)
		{
			if(isLeapYear(year)){
				if(month==2){
					return 29;
				}
			}else{
				if(month==2){
					return 28;
				}
			}
			return 30+month%2;
		}
		
		public static function isLeapYear(year:int):Boolean{
			if(year%4==0 && year%100!=0){
				return true;
			}
			
			if(year%4==0 && year%400==0){
				return true;
			}
			
			return false;
		}
		
		public static function calculate(year:int,month:int,unitPrice:Number):Number{
			var days:int=getDaysInMonth(year,month);
			return unitPrice*days;
		}
		
	}
}